export default{
    namespaced:true,
    state:{
        isShowToast:false,
        // 提示内容
        toastMsg:"",
        // 提示类型 (success,danger,warning)
        toastType:"",
    },
    mutations:{
        changeIsShowToast(state,payload){
            state.isShowToast =payload.show
            if(payload.show){
                state.toastMsg = payload.msg
                state.toastType = payload.type
            }
        }
    },
    actions:{
        asyncIsShowToast(context,payload){
            console.log("调用actions...");
            // 1.显示提示框
            context.commit("changeIsShowToast",payload);
            // 2.隐藏
            setTimeout(() => {
                context.commit("changeIsShowToast",{show:false})
            },1000)
        }
    }
}